package com.atguigu.gmall.search.respository;


import com.atguigu.gmall.search.bean.Person;
import org.springframework.data.elasticsearch.repository.ElasticsearchRepository;
import org.springframework.stereotype.Repository;

import java.util.Date;
import java.util.List;


/**
 * 简单的CRUD；
 * 复杂的CRUD； SQL、DSL（es检索领域专用语法）
 */
@Repository
public interface PersonRepository extends ElasticsearchRepository<Person, Long> {

    List<Person> getAllByUsernameLikeAndAgeGreaterThanEqual(String username, Integer age);

    List<Person> findAllByBirthDayBetween(Date birthDay, Date birthDay2);

    Long countAllByAddressLike(String address);

}
